package com.itheima.health;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@SpringBootApplication
public class ItcastHealthQuickStartApplication {

    public static void main(String[] args) {
        SpringApplication.run(ItcastHealthQuickStartApplication.class, args);
    }
    @RestController("")
    public class TestController {
        @GetMapping("/pc2")
        //
        public String r_url2(ServletRequest request, ServletResponse response) throws IOException {
            ((HttpServletResponse) response).sendRedirect("http://localhost:80/backend/pages/main.html");
            return "redirect";
        }

        @GetMapping("/pc1")
        //
        public String r_url1(ServletRequest request, ServletResponse response) throws IOException {
            ((HttpServletResponse) response).sendRedirect("http://localhost/backend/pages/login.html");
            return "redirect";
        }
        @GetMapping("/mo1")
        //
        public String r_url3(ServletRequest request, ServletResponse response) throws IOException {
            ((HttpServletResponse) response).sendRedirect("http://localhost/mobile/pages/login.html");
            return "redirect";
        }
        @GetMapping("/mo2")
        //
        public String r_url4(ServletRequest request, ServletResponse response) throws IOException {
            ((HttpServletResponse) response).sendRedirect("http://localhost/mobile/pages/index.html");
            return "redirect";
        }

    }
}
